const getName = new Promise((resolve, reject) => {
    setTimeout(() => {
        resolve("node.js")
    }, 1000)
})

const getNumber = Promise.resolve(1)
const getError = Promise.reject("error occured.")

getError.catch(console.error)

Promise.all([getName, getNumber])
.then(console.log)
.catch(console.error)

Promise.race([getName, getNumber])
.then(console.log)
.catch(console.error)

getName.then(name => {
    console.log(name)
    return 20
}).then(number => {
    console.log(number)
})